<!-- 
 * 个人中心页面
 * @author: 
 * @since: 2022-06-13
 * index.vue
-->
<template>
  <div class="person-center-container p20 h100">
    <router-view v-show="routerCutLevel === 3" class="detailsPage"></router-view>
    <div v-show="routerCutLevel === 2" class="listPage">
      <div class="tabs">
        <el-button type="primary" @click="tabsClick(1)" :class="{ isClick: state.tabsActive === 1 }" size="mini">
          <span class="btn-word">密码维护</span>
        </el-button>
        <el-button type="primary" @click="tabsClick(2)" :class="{ isClick: state.tabsActive === 2 }" size="mini">
          <span class="btn-word">我的消息</span>
        </el-button>
      </div>
      <editPassword v-if="state.tabsActive === 1"></editPassword>
      <myInfo v-if="state.tabsActive === 2"></myInfo>
    </div>
  </div>
</template>

<script setup>
import { reactive, computed, onMounted, watch } from 'vue'
import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
const router = useRouter();
const store = useStore();


const routerCutLevel = computed(() => {
  return store.getters['setting/routerCutLevel'];
});

const state = reactive({
  tabsActive: 1,//1.密码维护 2.我的消息
})
onMounted(() => {
  state.tabsActive = Number(router.currentRoute.value.query.type)
})

const tabsClick = (type) => {
  state.tabsActive = type
}
watch(
  () => router.currentRoute.value.query.type,
  () => {
    state.tabsActive = Number(router.currentRoute.value.query.type)
  },
);


</script>

<style lang="scss" scoped>
.person-center-container {
  box-sizing: border-box;
  .tabs {
    .el-button {
      color: #00a2ff;
      background: #fff;
      border: 1px solid #e3e3e3;
      transition: all, 0.3s;
    }
    .isClick {
      color: #fff;
      background: #00a2ff;
      border: 1px solid #00a2ff;
    }
  }
}
</style>
